package com.columboid.testharness.gui;

import java.awt.*;
import javax.swing.*;

import com.columboid.testharness.gui.swtdesigner.SwingResourceManager;

public class ColumboidSplash extends JWindow {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private class SplashPanel extends JPanel {

		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		public SplashPanel() {
			super();
			setBorder(BorderFactory.createLineBorder(Color.black));
			setLayout(new BorderLayout());
			ImageIcon i = new ImageIcon(SwingResourceManager.getImage(
					LoginFrame.class, "icons/logo.jpg"));
			JLabel label = new JLabel(i);
			add(label, "Center");
			MediaTracker tracker = new MediaTracker(label);
			tracker.addImage(i.getImage(), 0);
			try {
				tracker.waitForAll();
			} catch (InterruptedException ex) {
			}
		}
	}

	public ColumboidSplash() {
		getContentPane().add(new SplashPanel(), "Center");
		pack();
		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
		int height = getHeight();
		int width = getWidth();
		setLocation((screen.width - width) / 2, (screen.height - height) / 2);
		setVisible(true);
	}
}